//
//  OAError.h
//  OARetail
//
//  Created by ChenJie on 5/15/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, OAErrorType) {
    OAErrorTypeNetworkError = 1,
    OAErrorTypeAPIError,
    OAErrorTypeRequestSerializationError,
};

@interface OAError : NSObject

@property (nonatomic, assign) OAErrorType type;
@property (nonatomic, assign) NSInteger code;
@property (nonatomic, copy) NSString *message;
@property (nonatomic, strong) NSError *rawError;

+ (instancetype)errorWithType:(OAErrorType)type code:(NSInteger)code message:(NSString *)message;

+ (instancetype)errorWithRawError:(NSError *)rawError;

@end

